import * as jsonSchema from "json-schema";
import configSchema from "./config.schema.json";

interface Config {
    name: string;
    age: number;
    isStudent?: boolean;
}

function validateConfig(config: any): config is Config {
    const validator = new jsonSchema.Validator();
    return validator.validate(config, configSchema).valid;
}

const config: Config = {
    name: "John Doe",
    age: 30,
    isStudent: false,
};

if (validateConfig(config)) {
    console.log("Config is valid:", config);
} else {
    console.error("Config is invalid");
}
